
{extend name="index/index" /}
{block name='main'}
<div class="container">
    <div class="row">
   
        
             <div class="col-md-3" style="margin-top:30px;" ><img src="__UPLOAD__/music-img/{$list['img']}" style="height:200px;width:200px" ></div>
             <div class="col-md-6" id="geci">
               <ul>

                 <li style='line-height:25px'>单曲:{$list['name']}</li>
                 <li style='line-height:25px'>歌手:{$singer}</li>
                 <li>所属专辑:{$special}</li><br>
               <button class="btn btn-danger play" music="{$list['musicaddress']}" img='__UPLOAD__/music-img/{$list["img"]}' name='{$list["name"]}'>播放</button>

               
         
               <a href="{:url('index/Soucang/cang?id='.$list['id'])}"><button class="btn btn-primary">收藏</button></a>
      
             
      
        
               <button class="btn btn-primary">分享</button>
               <button class="btn btn-primary">下载</button>
               <button class="btn btn-primary">评价</button>
               <br>
               <br>
                <div id="myDIV">
                  <iframe src="__UPLOAD__/music-lrc/{$list['Lyrics']}" scrolling="auto" frameborder=0></iframe>
               
                </div>
             
                <br>
                <br>
         

              </ul>

             </div>
             <div class="col-md-3"></div>
           </div>
  
    

    <div class="row">
      <div class="col-md-9">
         <p style="color:red;font-size: 20px">评论:<span style="font-size:10px">共4730条评论</span></p>
         <hr style="border:1px solid red">
       </div>
      <div class="col-md-3"></div>
    </div>

    <form action='/index/Pinglun/ping' method="post">
    <input type="hidden" name="mid" value="{$list['id']}">

    <div class="row">
            <div class="col-md-1">
               <div><img src="__IMG__/1.jpg" style="height:40px;width:40px" ></div>
               </div>
            <div class="col-md-8">
         
                  <textarea name="pinglun" style="border:1px solid #ccc; height:40px;width: 740px;"></textarea>
                   
                          <span>140</span>
                         <button  class="btn btn-primary" id="ping">评论</button>  
               
                   
         
            </div>
            <div class="col-md-3"></div>
     </div>
     </form>



         <div class="row">
            <div class="col-md-9">
                <p>精彩评论</p>
                <hr style="border:1px solid #cfcfcf">
            </div>
            <div class="col-md-3"></div>
           
           
         </div>


        {foreach $res as $v}
        {if $phone==$v['phone']}
        <div id="{$v['id']}" class="row" style="margin-top:20px ">
            <div class="col-md-9">
                  <div class="row">
                     <div class="col-md-1">
                         <div>
                          {if empty($v['icon'])}
                          <img src="__IMG__/1.jpg" style="height:60px;width:60px" >
                          {else}
                          <img src="__UPLOAD__{$v.icon}" style="height:60px;width:60px" >
                          {/if}
                         </div>
                     </div>
                     <div class="col-md-10">
                          <div style="border:2px solid #ccc;height:45px">
                          {if empty($v['name'])}
                          {$v['phone']}:{$v['pinglun']}
                          {else}
                          {$v['name']}:{$v['pinglun']}
                          {/if}
                          </div>
                          <button data-id="{$v['id']}" class="btn btn-danger btn-xs del-btn">删除</button>
                          <span>{$v['createtime']}</span>
                          <br>
                          {foreach $re as $val}
                          {if($val['cid'] == $v['id'])}
                            <div  style="border:1px solid black; height:40px;width: 700px;">
                          {$val['huifu']}
                            </div>
                          
                          {else}
                            <div>
                              
                    
                            </div>
                          {/if}
                          {/foreach}

                         
                     </div>

              
                
                  <div class="col-md-1">
                     <button class="btn btn-danger  btn-xs ">点赞</button><br>
                     <button class="btn btn-primary  btn-xs  hf" data-id="{$v['id']}">回复</button>
                  </div>
                 </div>
            </div>
             
           
           
         </div>
        {else}

           <div id="{$v['id']}" class="row" style="margin-top:20px ">
            <div class="col-md-9">
                  <div class="row">
                     <div class="col-md-1">
                         <div>
                          <img src="__UPLOAD__{$v.icon}" style="height:60px;width:60px" >
                         </div>
                     </div>
                     <div class="col-md-10">
                          <div style="border:2px solid #ccc;height:45px">
                          {$v['pinglun']}
                          </div>
                        
                          <span>{$v['createtime']}</span>
                          <br>
                          {foreach $re as $val}
                          {if($val['cid'] == $v['id'])}
                            <div  style="border:1px solid black; height:40px;width: 700px;">
                          {$val['huifu']}
                            </div>
                          
                          {else}
                            <div>
                              
                    
                            </div>
                          {/if}
                          {/foreach}

                         
                     </div>

              
                
                  <div class="col-md-1">
                     <button class="btn btn-danger  btn-xs ">点赞</button><br>
                     <button class="btn btn-primary  btn-xs  hf" data-id="{$v['id']}">回复</button>
                  </div>
                 </div>
            </div>
             
           
           
         </div>

        {/if}
        {/foreach}
        <br>
        <br>
        <div class="container">
         <div class="col-md-12">

         <div class="hui" style="border:1px solid black;width:700px;height:70px;display:none;margin-left:42px;">
             <form action="{:url('index/Pinglun/hf')}" method="post">
                             <input type="hidden" name="mid" value="{$list['id']}">
                             <textarea name="pinglun" style="border:1px solid #ccc; height:40px;width:699px;" >回复:</textarea>
                             <button class="btn btn-primary  btn-xs " style="float:right" >回复</button>
             </form>
         </div>    
         </div>  
         </div>                               

          <script>
            $('.hf').click(function(){
              var id = $(this).attr('data-id');
              $('.hui').css('display','block')
              $('.hui form').append('<input type="hidden" name="cid" value="'+id+'"/>')
            })

          </script>
        
     
    </div>


</div>
<script>





$(function(){
            //触发用户删除
            $('.del-btn').click(function(){
             var ac_id = $(this).attr('data-id');
            if (confirm('您确定要[删除]该评论么?')) {

              var obj = $('#'+ac_id);
              delAjax(ac_id,obj);//执行删除操作
            }

            

            })



            

        });

        function delAjax(id,obj)
        {
          $.ajax({
            type:'delete',
            url:'/index/Pinglun/delete/id/' + id,
            // dateType:'json',

            success:function(data){
              if (data.status) {
                 alert('删除成功!!!');
                 obj.remove();
              }else{
                 alert('删除失败!!!');
              }
            },

            error:function(){
              //Ajax执行失败
              alert('Ajax执行失败')
            }

          });
        }


       





    


    

</script>

{/block}